package mr

//
// RPC definitions.
//
// remember to capitalize all names.
//

import "os"
import "strconv"

//
// example to show how to declare the arguments
// and reply for an RPC.
//

type ExampleArgs struct {
	X int
}

type ExampleReply struct {
	Y int
}

// Task status enum
// zero as no task to assign (MapReduce finished)
// one as map task
// two as reduce task
// three as all map tasks assigned, but yet not completed
const (
	NO_TASK int  = 0
	MAP_TASK     = 1
	REDUCE_TASK  = 2
	TEMP_NO_TASK = 3
)


// Add your RPC definitions here.
type AssignedTask struct {
	TaskType int
	TaskId int
	// This field for map task only
	NumOfOutput int
	
	InputFileNames []string
}

type FinishedTask struct {
	TaskType int
	TaskId int
	OutputFileNames []string
}

// Cook up a unique-ish UNIX-domain socket name
// in /var/tmp, for the coordinator.
// Can't use the current directory since
// Athena AFS doesn't support UNIX-domain sockets.
func coordinatorSock() string {
	s := "/var/tmp/5840-mr-"
	s += strconv.Itoa(os.Getuid())
	return s
}
